﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeBehind="AllTournaments.aspx.cs" Theme="SkinFile" Inherits="Nivdal.AllTournaments" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="basic_element">
    <div class="red_title">
        <asp:Label ID="OngoingTournamentsTitleLabel" runat="server" Text="<%$ Resources:Resource, AllTournaments_OngoingTournaments %>" CssClass="white_title" ></asp:Label>
    </div>
    <div class="padding5">
        <asp:Panel ID="MessagePanel" runat="server">
            <asp:Label ID="MessageLabel" runat="server" SkinID="GreenSmallHeaderLabel"></asp:Label>
            <br /><br />
        </asp:Panel>
        <asp:Gridview ID="SignupTournamentsGriedview" runat="server" DataSourceID="SignupTournamentsDataSource" AutoGenerateColumns="false" PageSize="20" SkinID="BigProfessional">
        <PagerSettings FirstPageText="<%$ Resources:Resource, FirstPage %>" LastPageText="<%$ Resources:Resource, LastPage %>"
            Mode="NumericFirstLast" PageButtonCount="10" Position="Bottom" />
        <PagerStyle CssClass="pagination" HorizontalAlign="Center" />
        <Columns>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, CreateTournament_TournamentNameTitle %>">
                <ItemTemplate>
                    <asp:HyperLink ID="TournamentLink" runat="server" Text='<%# Eval("TournamentName") %>' SkinID="BlackHyperLinkSkin"
                     NavigateUrl='<%# "~/Tournament.aspx?Id=" + Eval("TournamentId") %>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Tournament_TournamentStageTitle %>">
                <ItemTemplate>
                    <asp:Label ID="TournamentStageLabel" runat="server" SkinID="GridLabel" Text='<%# Eval("TournamentStage") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField> 
            <asp:TemplateField HeaderText="<%$ Resources:Resource, CreateTournament_TournamentTypeTitle %>">
                <ItemTemplate>
                    <asp:Label ID="TournamentTypeLabel" runat="server" SkinID="GridLabel" Text='<%# Eval("TournamentType") %>' ></asp:Label>
                    <asp:Label ID="NumTeamsLabel" runat="server" SkinID="GridLabel" Text='<%# "(" + Eval("NumSignedTeams") + "/" + Eval("NumTeams") + ")" %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
         
            <asp:TemplateField HeaderText="<%$ Resources:Resource, CreateTournament_SignupTypeTitle %>" >
                <ItemTemplate>
                    <asp:Label ID="SignupTypeLabel" runat="server" SkinID="GridLabel" Visible='<%# Eval("ExecutionStatus").ToString() == "1" %>'
                     Text='<%# (bool)Eval("PasswordProtected") ? Resources.Resource.CreateTournament_SignupTypePassword : Resources.Resource.CreateTournament_SignupTypeFree %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Tournament_TotalPremiumPrizes %>">
                <ItemTemplate>
                    <asp:Label ID="PremiumPrizesLabel" runat="server" SkinID="GridLabel" Text='<%# Eval("TotalPremiumPrizes") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Tournament_DirectorsTitleLabel %>">
                <ItemTemplate>
                    <asp:HiddenField ID="TournamentIdHiddenField" runat="server" Value='<%# Eval("TournamentId") %>' />
                    <asp:Repeater ID="DirectorsRepeater" runat="server" DataSourceID="DirectorsDataSource">
                        <SeparatorTemplate>,</SeparatorTemplate>
                        <ItemTemplate>
                            <asp:HyperLink ID="UserHyperlink" runat="server" NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("UserId") %>'
                                Text='<%# Eval("UserName") %>' SkinID="GreenTitleHyperLink"></asp:HyperLink>
                        </ItemTemplate>
                    </asp:Repeater>
                    <asp:SqlDataSource ID="DirectorsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                    SelectCommand="Nivdal_GetTournamentDirectors" SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="TournamentIdHiddenField" PropertyName="Value" Name="TournamentId" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <asp:Label ID="NoTournamentsLabel" runat="server" Text="<%$ Resources:Resource, AllTournaments_NoTournaments %>" SkinID="GridLabel"></asp:Label>
        </EmptyDataTemplate>
        </asp:Gridview>
        <asp:SqlDataSource ID="SignupTournamentsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_GetSignupFriendlyTournaments" SelectCommandType="StoredProcedure">
        </asp:SqlDataSource>
        <br /><br />
        <asp:HyperLink ID="CreateTournamentLink" runat="server" Text="<%$ Resources:Resource, CreateTournament_CreateTournamentButtonText %>" 
        SkinID="GreenTitleHyperLink" NavigateUrl="~/CreateTournament.aspx"></asp:HyperLink>
        <br /><br />
        <asp:Gridview ID="OngoingFriendlyTournamentsGridview" runat="server" DataSourceID="OngoingTournamentsDataSource" AutoGenerateColumns="false" PageSize="20" SkinID="BigProfessional">
        <PagerSettings FirstPageText="<%$ Resources:Resource, FirstPage %>" LastPageText="<%$ Resources:Resource, LastPage %>"
            Mode="NumericFirstLast" PageButtonCount="10" Position="Bottom" />
        <PagerStyle CssClass="pagination" HorizontalAlign="Center" />
        <Columns>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, CreateTournament_TournamentNameTitle %>">
                <ItemTemplate>
                    <asp:HyperLink ID="TournamentLink" runat="server" Text='<%# Eval("TournamentName") %>' SkinID="BlackHyperLinkSkin"
                     NavigateUrl='<%# "~/Tournament.aspx?Id=" + Eval("TournamentId") %>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Tournament_TournamentStageTitle %>">
                <ItemTemplate>
                    <asp:Label ID="TournamentStageLabel" runat="server" SkinID="GridLabel" Text='<%# Eval("TournamentStage") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField> 
            <asp:TemplateField HeaderText="<%$ Resources:Resource, CreateTournament_TournamentTypeTitle %>">
                <ItemTemplate>
                    <asp:Label ID="TournamentTypeLabel" runat="server" SkinID="GridLabel" Text='<%# Eval("TournamentType") %>' ></asp:Label>
                    <asp:Label ID="NumTeamsLabel" runat="server" SkinID="GridLabel" Text='<%# "(" + Eval("NumSignedTeams") + "/" + Eval("NumTeams") + ")" %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>         
            <%--<asp:TemplateField HeaderText="<%$ Resources:Resource, CreateTournament_SignupTypeTitle %>" >
                <ItemTemplate>
                    <asp:Label ID="SignupTypeLabel" runat="server" SkinID="GridLabel" Visible='<%# Eval("ExecutionStatus").ToString() == "1" %>'
                     Text='<%# (bool)Eval("PasswordProtected") ? Resources.Resource.CreateTournament_SignupTypePassword : Resources.Resource.CreateTournament_SignupTypeFree %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>--%>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Tournament_TotalPremiumPrizes %>">
                <ItemTemplate>
                    <asp:Label ID="PremiumPrizesLabel" runat="server" SkinID="GridLabel" Text='<%# Eval("TotalPremiumPrizes") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Tournament_DirectorsTitleLabel %>">
                <ItemTemplate>
                    <asp:HiddenField ID="TournamentIdHiddenField" runat="server" Value='<%# Eval("TournamentId") %>' />
                    <asp:Repeater ID="DirectorsRepeater" runat="server" DataSourceID="DirectorsDataSource">
                        <SeparatorTemplate>,</SeparatorTemplate>
                        <ItemTemplate>
                            <asp:HyperLink ID="UserHyperlink" runat="server" NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("UserId") %>'
                                Text='<%# Eval("UserName") %>' SkinID="GreenTitleHyperLink"></asp:HyperLink>
                        </ItemTemplate>
                    </asp:Repeater>
                    <asp:SqlDataSource ID="DirectorsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                    SelectCommand="Nivdal_GetTournamentDirectors" SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="TournamentIdHiddenField" PropertyName="Value" Name="TournamentId" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <asp:Label ID="NoTournamentsLabel" runat="server" Text="<%$ Resources:Resource, AllTournaments_NoTournaments %>" SkinID="GridLabel"></asp:Label>
        </EmptyDataTemplate>
        </asp:Gridview>
        <asp:SqlDataSource ID="OngoingTournamentsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_GetOngoingFriendlyTournaments" SelectCommandType="StoredProcedure">
        </asp:SqlDataSource>
    </div>
    </div>
    
    <div class="basic_element">
    <div class="red_title">
        <asp:Label ID="CompletedTournamentsTitleLabel" runat="server" Text="<%$ Resources:Resource, AllTournaments_CompletedTournaments %>" CssClass="white_title"></asp:Label>
    </div>
    <div class="padding5">
    
        <asp:GridView ID="CompletedTournamentsGridview" runat="server" DataSourceID="CompletedTournamentsSqlDataSource" AutoGenerateColumns="false" PageSize="20" SkinID="BigProfessional">
        <PagerSettings FirstPageText="<%$ Resources:Resource, FirstPage %>" LastPageText="<%$ Resources:Resource, LastPage %>"
            Mode="NumericFirstLast" PageButtonCount="10" Position="Bottom" />
        <PagerStyle CssClass="pagination" HorizontalAlign="Center" />
        <Columns>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, CreateTournament_TournamentNameTitle %>">
                <ItemTemplate>
                    <asp:HyperLink ID="TournamentLink" runat="server" Text='<%# Eval("TournamentName") %>' SkinID="BlackHyperLinkSkin"
                     NavigateUrl='<%# "~/Tournament.aspx?Id=" + Eval("TournamentId") %>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, CreateTournament_TournamentTypeTitle %>">
                <ItemTemplate>
                    <asp:Label ID="TournamentTypeLabel" runat="server" SkinID="GridLabel" Text='<%# Eval("TournamentType") %>' ></asp:Label>
                    <asp:Label ID="NumTeamsLabel" runat="server" SkinID="GridLabel" Text='<%# "(" + Eval("NumSignedTeams") + ")" %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_Winner %>">
                <ItemTemplate>
                    <asp:HyperLink ID="WinnerLink" runat="server" Text='<%# Eval("WinnerName")%>' SkinId="GreenTitleHyperLink"
                    NavigateUrl='<%# "~/TeamHomePage.aspx?TeamId=" + Eval("WinnerId") %>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Tournament_DirectorsTitleLabel %>">
                <ItemTemplate>
                    <asp:HiddenField ID="TournamentIdHiddenField" runat="server" Value='<%# Eval("TournamentId") %>' />
                    <asp:Repeater ID="DirectorsRepeater" runat="server" DataSourceID="DirectorsDataSource">
                        <SeparatorTemplate>,</SeparatorTemplate>
                        <ItemTemplate>
                            <asp:HyperLink ID="UserHyperlink" runat="server" NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("UserId") %>'
                                Text='<%# Eval("UserName") %>' SkinID="GreenTitleHyperLink"></asp:HyperLink>
                        </ItemTemplate>
                    </asp:Repeater>
                    <asp:SqlDataSource ID="DirectorsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                    SelectCommand="Nivdal_GetTournamentDirectors" SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="TournamentIdHiddenField" PropertyName="Value" Name="TournamentId" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <asp:Label ID="NoTournamentsLabel" runat="server" Text="<%$ Resources:Resource, AllTournaments_NoTournaments %>" SkinID="GridLabel"></asp:Label>
        </EmptyDataTemplate>
        </asp:GridView>
    </div>
    </div>
    <asp:SqlDataSource ID="CompletedTournamentsSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_GetCompletedFriendlyTournaments" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PageNamePlaceHolder" runat="server">
    <asp:Label ID="PageNameLabel" runat="server" CssClass="PageNameContentStyle" Text="<%$ Resources:Resource, AllTournaments_PageTitle %>" ></asp:Label>
</asp:Content>
